package top.yxqz.number4.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import top.yxqz.number4.entity.Emp;
import top.yxqz.number4.service.EmpService;

/**
 * @author: 余小小
 * @date: 2023/9/25
 * @description：
 */
@RestController
public class EmpController {

    @Autowired
    private EmpService service;


    /**
     * 通过id查询员工信息（主键）
     * <p>
     * 单条件查询
     * url:localhost/emp/1
     */
    @GetMapping("/emp/{empId}")
    public Emp getEmpById(@PathVariable("empId") Integer id) {
        Emp emp = service.getById(id);
        return emp;
    }
}
